using System.Collections.Generic;
using UnityEngine;

namespace Gj
{
    public static class CountryTools
    {
        private static readonly string[] countrys;

        static CountryTools()
        {
            var settings = LoadSettings();
            countrys = settings.countrys.Split(',');
        }

        private static CountrySettings LoadSettings()
        {
            var loadedSettings = (CountrySettings)Resources.Load("CountrySettings", typeof(CountrySettings));
            if (loadedSettings == null)
            {
                loadedSettings = ScriptableObject.CreateInstance<CountrySettings>();
                Debug.LogError("CountrySettings is not exist (Resources)");
            }

            return loadedSettings;
        }

        public static string[] GetCountrys()
        {
            return countrys;
        }
    }
}